package com.lipeng.controller;

import com.lipeng.bean.Order;
import com.lipeng.service.OrderService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dllo on 18/3/8.
 */
@Controller
public class OrderController {
    @Resource
    private OrderService orderService;

    @RequestMapping(value = "orderlist")
    public String orderList(){
        return "orderlist";
    }

    @RequestMapping(value = "ordersearch")
    public String orderSearch(){
        return "ordersearch";
    }

    @ResponseBody
    @RequestMapping(value = "allorder")
    public List<Order> findAllOrder(){
        return orderService.findAllOrder();
    }

    @ResponseBody
    @RequestMapping(value = "searchordername")
    public Order selectOrderById(@RequestParam("oid") Integer oid){
        return orderService.selectOrderById(oid);
    }
}
